package com.chase.champagne.entity

import org.litepal.crud.LitePalSupport
import java.text.SimpleDateFormat
import java.util.*

open class ChampagneRecord(var date: Date, var time: String, var id: Long? = null) : LitePalSupport() {
    override fun toString(): String {
        return "ChampagneRecord(date=$date, time='$time')"
    }

    fun getFormatDate(format: SimpleDateFormat = SimpleDateFormat("yyyy-MM-dd hh:mm")) = format.format(date)

    private val calendar = Calendar.getInstance().apply { time = date }

    val month = calendar.get(Calendar.MONTH) + 1
    val day = calendar.get(Calendar.DATE)
    val year = calendar.get(Calendar.YEAR)
}